package com.baitengsoft.patentapimonitor.api.dao;

import com.baitengsoft.patentapimonitor.api.entity.CfgPatentIndicatorEntity;
import com.baitengsoft.patentapimonitor.api.model.CfgPatentIndicatorInfo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.math.BigDecimal;
import java.util.List;

/**
 * 指标管理dao
 * @author Chen 2017/12/15
 */
@Mapper
@Repository
public interface CfgPatentIndicatorDao extends BasetkRepository<CfgPatentIndicatorEntity> {
    /**
     * 根据平台Id查询平台下属指标汇总
     */
    List<CfgPatentIndicatorInfo> getPatIndicatorSumByAreaIds(List<Integer> ids);

    /**
     * 根据平台下属的区域，年份查询 列表
     */
    List<CfgPatentIndicatorInfo> getPatIndicatorByAreaAndYear(@Param("areaids") List<Integer> areaids,@Param("year") Integer year);


    /**
     * 根据平台ID和年份获取人口总和
     */
    BigDecimal getPopulationByPlatAndYear(@Param("areaIds") List<Integer> areaIds, @Param("currentYear") Integer currentYear);

    float getAllIndicatorSum(@Param("areaIds") List<Integer> areaIds, @Param("currentYear") Integer currentYear);

    /**
     * 根据区域ID和年份进行删除
     */
    void deleteByAreaIdAndYearYM(@Param("id") Integer id, @Param("currentYear") Integer currentYear);

    /**
     * 根据区域ID和年份进行c初始化
     */
    void initIndicatorByAreaIdAndDateYM(@Param("id") Integer id, @Param("currentYear") Integer currentYear);
}